package com.qf.test;

import com.qf.pojo.User;
import com.qf.service.UserService;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;
import java.util.List;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/8/29 11:38
 */
@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration("classpath:application.xml")
public class CeShi {
    private UserService userService;
    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }
    @Test
    public void demo01(){
        User user=userService.findById(1);
        System.out.println("user = " + user);
    }
    @Test
    public void demo02(){
        List<User> user= userService.findAll();
        System.out.println("user = " + user);
    }
    @Test
    public void demo03(){
        User user = new User();
        user.setUsername("wangwei");
        user.setPassword("123");
        user.setAddress("shanghai");
        user.setPhone("13245645");
        user.setMoney(100);
        int i = userService.AddUser(user);
    }

}
